<?php

if(isset($_SERVER["HTTP_X_REQUESTED_WITH"]))
{
	$str = '';
	$page = empty($_GET['page'])?1:$_GET['page'];
	$len=5;
	$product = partion($page,'product',$len);
	$count = selectOne('product','1','count(*) as count')['count'];
	$str = partienRender($count,$len,$page);
	//处理时间戳
	foreach($product as $k=>$v)
	{
		foreach($v as $key=>$val)
		{
			if($key=='content')
			{
				$product[$k][$key]=mb_substr(strip_tags($val), 0,100,'utf-8');	
			}
		}
	}
	echo json_encode(array('table'=>$product,'render'=>$str));
	die;
}

$str = '';
$page = empty($_GET['page'])?1:$_GET['page'];
$len=5;
$product = partion($page,'product',$len);
//foreach($product as $k=>$v)
//{
//	$product[$k]['content'] = mb_substr($v['content'], 0,1000,'utf-8');
//}
$count = selectOne('product','1','count(*) as count')['count'];
$str = partienRender($count,$len,$page);


include 'app/admin/product/html/index.html';
?>